package com.uzai.common.enums;

/**
 * The enum Work order opt type.
 *
 * @author mingyang.chen create in 2023/6/16 14:21
 */
public enum WorkOrderType {

    /**
     * Bug work order type.
     */
    BUG(1, "BUG"),
    /**
     * Task work order type.
     */
    TASK(2, "需求"),

    /**
     * Complaint work order type.
     */
    COMPLAINT(3, "投诉建议"),

    ;

    private final int code;

    private final String desc;

    WorkOrderType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public int getCode() {
        return code;
    }

    /**
     * Gets desc.
     *
     * @return the desc
     */
    public String getDesc() {
        return desc;
    }

    /**
     * Gets by code.
     *
     * @param code the code
     * @return the by code
     */
    public static WorkOrderType getByCode(Integer code) {
        for (WorkOrderType value : WorkOrderType.values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }

}
